package com.alibaba.ecool.dao.impl;

import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.alibaba.ecool.bean.LoginUser;
import com.alibaba.ecool.bean.User;
import com.alibaba.ecool.dao.LoginUserDAO;



public class LoginUserDAOImpl extends SqlMapClientDaoSupport implements LoginUserDAO{

	@Override
	public int getUserByName(String username) {
		List list=(List) this.getSqlMapClientTemplate().queryForList("getUserByName", username);
		
		return list.size();
	}

	@Override
	public void updataUser(String username, String password, String email) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public LoginUser getUserByNameAndPwd(String username, String password) {
		LoginUser loginUser=new LoginUser(username,password);
		return (LoginUser) this.getSqlMapClientTemplate().queryForObject("getUserByNameAndPwd", loginUser);
	}

	@Override
	public void insertUser(User user) {
		this.getSqlMapClientTemplate().insert("insertUser", user);		
	}

}
